import 'package:get/get.dart';
import 'package:ladder_cash/app/app.dart';
import 'package:ladder_cash/app/com/http/http_request.dart';
import 'package:ladder_cash/app/com/model/login_user_info_model.dart';
import 'package:ladder_cash/app/com/service/user_service.dart';
import 'package:ladder_cash/app/key_mix.dart';

import '../../../gen/assets.gen.dart';
import '../../../generated/l10n.dart';

class MineLogic extends GetxController {
  LoginUserInfoModel userInfoModel = App.userInfoModel;
  UserService userService = UserService();
  int couponCount = 0;
  String? name;
  List<dynamic>? mineMenus;
  var agree = false;

  changeAgree(){
    agree = !agree;
    update();
  }

  final List<Map<String, dynamic>> orderList = [
    {'title': S.current.apply, 'img': Assets.my.myOrder1.path},
    {'title': S.current.repayment, 'img': Assets.my.myOrder2.path},
    {'title': S.current.finished, 'img': Assets.my.myOrder3.path},
  ];


  bool isVerify = false;
  getMineMenus({refresh = false}) async {
    dynamic data =
        await HttpRequest().get('/v3/personal-center/user-menu'.hx, null);
    mineMenus = data['list'.hx];
    isVerify = (data['cars'.hx] ?? 0) == 1;
    // name=data?['userInfo']?['username'];
    if (refresh) {
      update();
    }
    return mineMenus;
  }
}
